package com.jic.market.controller.after;


import com.jic.common.base.vo.RestResult;
import com.jic.market.api.after.MarketApi;
import com.jic.market.request.PromotionPolymericRequest;
import com.jic.market.request.rest.PresellProductRequest;
import com.jic.market.request.rest.groupon.GrouponInfoRequest;
import com.jic.market.request.rest.seckill.SeckillInfoRequest;
import com.jic.market.response.PresellProductResponse;
import com.jic.market.response.PromotionPolymericProductResponse;
import com.jic.market.response.PromotionPolymericResponse;
import com.jic.market.response.PromotionSingleProductResponse;
import com.jic.market.response.rest.SeckillInfoResponse;
import com.jic.market.response.rest.groupon.GroupInfoFeignResponse;
import com.jic.market.response.rest.groupon.GrouponInfoResponse;
import com.jic.market.service.PromotionMerchantProductService;
import com.jic.market.service.coupon.CouponDetailService;
import com.jic.market.service.rest.groupon.GrouponRestService;
import com.jic.market.service.rest.seckill.SeckillRestService;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;


/**
 * @author wj
 * @Description:
 * @date 2020-05-13 10:24
 */
@RestController
@RequestMapping("/api/marketApi")
@Api(tags = {"后端调用-营销中心"})
@Slf4j
public class MarketController implements MarketApi {

    @Autowired
    private GrouponRestService grouponRestService;

    @Autowired
    private SeckillRestService seckillRestService;

    @Autowired
    private CouponDetailService couponDetailService;

    @Autowired
    private PromotionMerchantProductService promotionMerchantProductService;

    @Override
    public RestResult<GrouponInfoResponse> getGroupInfo(GrouponInfoRequest request) {
        return grouponRestService.grouponInfo(request);
    }

    @Override
    public RestResult<SeckillInfoResponse> getSecondsKillInfo(SeckillInfoRequest seckillInfoRequest) {
        return seckillRestService.getSecondsKillInfo(seckillInfoRequest);
    }

    @Override
    public RestResult<String> updateCouponStatus(String couponCode) {
        return couponDetailService.updateCouponStatus(couponCode);
    }

    @Override
    public RestResult<PresellProductResponse> queryPresellByMpId(PresellProductRequest request){
        return promotionMerchantProductService.queryPresellByMpId(request);
    }

    @Override
    public RestResult<PromotionPolymericResponse> queryPromotionProduct(PromotionPolymericRequest request){
        return promotionMerchantProductService.queryPromotionProduct(request);
    }

    @Override
    public RestResult<PromotionSingleProductResponse> querySingleByMpId(PromotionPolymericRequest request) {
        return promotionMerchantProductService.querySingleByMpId(request);
    }

    @Override
    public RestResult<List<PromotionSingleProductResponse>> querySingleByMpIds(List<Long> mpIds) {
        return promotionMerchantProductService.querySingleByMpIds(mpIds);
    }

}
